import request from '@/utils/request'

export interface LoginParams {
  username: string
  password: string
}

export interface UserInfo {
  id?: string
  username?: string
}

// 用户登录
export const login = (data: LoginParams) => {
  return request({
    url: '/admin/login',
    method: 'post',
    data,
  })
}

// 获取用户信息
export const getUserInfo = () => {
  return request({
    url: '/admin/profile',
    method: 'get',
  })
}

// 用户登出
export const logout = () => {
  return request({
    url: '/admin/logout',
    method: 'post',
  })
}
